function EditableTextInit(edt_el, onChanged)
{
	edt_el.focusin(function(){OnCaptionFocus(edt_el);});
	edt_el.focusout(function(){OnCaptionLeaveFocus(edt_el, onChanged);});
	edt_el.keydown(function(evnt){OnCaptionKeyDown(evnt, edt_el, onChanged);});
}

function OnCaptionFocus(edt_el)
{
	edt_el.removeAttr('readonly');
	edt_el.removeClass('inactive');
}

function OnCaptionLeaveFocus(edt_el, onChanged)
{
	edt_el.attr('readonly', 'true');
	edt_el.addClass('inactive');
	onChanged();
}

function OnCaptionKeyDown(evnt, edt_el, onChanged)
{
	if(evnt.keyCode == 13)
	{
		edt_el.blur();
		edt_el.addClass('inactive');
		onChanged();
	}
}
